feat: Improve usage limit handling and data freshness#1877
Merged
charlesvien merged 13 commits intomainfrom Apr 24, 2026
Merged
feat: Improve usage limit handling and data freshness#1877charlesvien merged 13 commits intomainfrom
charlesvien merged 13 commits intomainfrom
Conversation
5a258cc to
57eb4de
Compare
5eb1a5d to
f8cae14
Compare
Prompt To Fix All With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/billing/hooks/useUsageLimitDetection.ts
Line: 22-32
Comment:
**Idle usage-exceeded state silently dropped**
The previous code showed a modal for both active and idle states when usage was exceeded. After this change, if usage is exceeded while no session has `isPromptPending`, `hasAlertedRef.current` is never set to `true`, so the condition re-evaluates on every usage poll (now every 30 s) but never triggers anything. Users who hit their limit while idle receive no proactive notification — they'll only see the modal if they subsequently start a prompt that bounces back a 429 and gets caught in `service.ts`.
If this is intentional (prefer reactive detection over proactive polling for the idle case), a comment here would help future maintainers understand why the `show("idle")` path was removed entirely.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: apps/code/src/shared/errors.ts
Line: 23-27
Comment:
**Bare `"429"` substring pattern is overly broad**
`includesAny` does a case-insensitive `.includes()` check, so any error message containing the three characters `429` (e.g., `"session not found after 429 retries"`, a port number, a token ID, etc.) will be classified as a rate-limit error and suppress fatal-error recovery in `isFatalSessionError`. Prefer matching on the full HTTP status line or a more anchored pattern like `" 429 "` / `"status 429"` to reduce the risk of false positives.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "Only show usage modal mid-task not on id..." | Re-trigger Greptile |
k11kirky
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Usage limits were silently swallowed or triggered at wrong times, and billing data went stale after plan changes.
Changes
How did you test this?
Manually